<template>
  <div>
    Parent {{ food }}
    <p>
      <button @click="changeChildValue">直接改子组件的值</button>
    </p>
    <hr />
    <Child ref="childRef" />
  </div>
</template>

<script>
import Child from './Child.vue'
export default {
  components: {
    Child
  },
  data () {
    return {
      food: '猪脚饭'
    }
  },
  methods: {
    changeChildValue () {
      //   console.log(this.$refs.childRef)
      this.$refs.childRef.count++
      this.$refs.childRef.test()
    }
  }
}
</script>
